package com.hogae.capital.controller;

import com.hogae.capital.domain.Withdrawal;
import com.hogae.capital.service.IWithdrawalService;
import com.hogae.core.core.domain.AjaxResult;
import com.hogae.core.core.domain.model.LoginUser;
import com.hogae.core.utils.ServletUtils;
import com.hogae.core.web.service.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 提现接口
 */
@Api(tags = "提现接口")
@RestController
@RequestMapping("/capital/withdrawal")
public class WithdrawalController {

    @Autowired
    IWithdrawalService withdrawalService;

    @Autowired
    private TokenService tokenService;

    /**
     * 银行卡提现
     * @param withdrawal
     * @return
     */
    @ApiOperation("银行卡提现")
    @GetMapping("/bankCard")
    public AjaxResult bankCard(Withdrawal withdrawal){
        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
        return AjaxResult.success(withdrawalService.bankCard(withdrawal,loginUser));
    }
}
